package com.aaa.controller;

import com.aaa.service.ViewResultSdsService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @create by: 玙德（3084385240@qq.com）
 * @description:
 * @create time: 2022/7/8 21:07
 * @param
 * @return
 */
@Controller
@RequestMapping("result")
public class ViewResultSdsController {
        @Autowired
    private ViewResultSdsService viewResultSdsService;

    @RequestMapping("resultTest.do")
    public String resultTest(@Param(value = "userId") String userId, @Param(value = "type") String type) {
        System.out.println(userId);
        System.out.println(type);
        String s = viewResultSdsService.selectResult(Integer.parseInt(userId), type);
        System.out.println(s);
         if (s.equals("SdsNormal")) {
            return "/character/SdsNormal";
            //轻度抑郁
        } else if (s.equals("SdsMild")) {
            return "/character/SdsMild";
            //中度抑郁
        } else if (s.equals("SdsModerate")) {
            return "/character/SdsModerate";
            //重度抑郁
        } else if (s.equals("SdsSevere")) {
            return "/character/SdsSevere";
        }
        return null;
    }

}
